'use strict';
var emClient = {}
//demo，测试代码
emClient.testNative = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('testObjcCallback', params, callback)
}
//>获取当前网络ip
emClient.getIP = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getIP', params, callback)
}

//调用系统打印方法，打印webviwe
emClient.print = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('print', params, callback)
}


//系统分享
emClient.share = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('share', params, callback)
}



//
emClient.shareToWechat = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('shareToWechat', params, callback)
}


emClient.openNativeChangeTheme = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('openNativeChangeTheme', params, callback)
}

emClient.openApp = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('openApp', params, callback)
}


//getAccount
emClient.getAccount = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getAccount', params, callback)
}


//关闭当前窗口
emClient.closeWindow = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('closeWindow', params, callback)
}
//关闭当前窗口并且刷新
emClient.closeAndReload = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('closeAndReload', params, callback)
}
//获取会话用户列表
emClient.getUserFromConversation = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getUserFromConversation', params, callback)
}
//用默认浏览器打开连接
emClient.openLink = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('openLink', params, callback)
}
//内置浏览器打开新窗口
emClient.openNewWindow = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('openNewWindow', params, callback)
}
//获取地理位置
emClient.getLocation = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getLocation', params, callback)
}
//打开地理位置
emClient.openLocation = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('openLocation', params, callback)
}
//选取相册
emClient.chooseImage = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('chooseImage', params, callback)
}
//选取视频
emClient.chooseVideo = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('chooseVideo', params, callback)
}
//获取照片数据
emClient.getLocalImgData = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getLocalImgData', params, callback)
}
//上传图片
emClient.uploadImage = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('uploadImage', params, callback)
}
//下载图片
emClient.downloadImage = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('downloadImage', params, callback)
}
//预览图片
emClient.previewImage = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('previewImage', params, callback)
}

//选取视频
emClient.chooseVideo = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('chooseVideo', params, callback)
}

//上传视频
emClient.uploadVideo = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('uploadVideo', params, callback)
}


//下载视频
emClient.downloadVideo = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('downloadVideo', params, callback)
}


// 发起单聊
emClient.initiatePrivateChat = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('initiatePrivateChat', params, callback)
}
// 发起群聊 指定人
emClient.initiateGroupChat = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('initiateGroupChat', params, callback)
}
// 发起群聊 选择人
emClient.selectUserinitiateChat = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('selectUserinitiateChat', params, callback)
}

// 打开会话列表
emClient.openChatList = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('openChatList', params, callback)
}
// 获取聊天群组
emClient.getDiscussion = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getDiscussion', params, callback)
}

// 发消息到群组
emClient.openConversation = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('openConversation', params, callback)
}

// 获取网络情况
emClient.getNetWorkInfo = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getNetWorkInfo', params, callback)
}
// 获取当前wifi信息
emClient.getCurrentWifiInfo = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getCurrentWifiInfo', params, callback)
}
// 扫一扫
emClient.scanQRCode = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('scanQRCode', params, callback)
}


// 扫一扫
emClient.saveLog = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('saveLog', params, callback)
}


// 扫一扫
emClient.pushToLogin = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('pushToLogin', params, callback)
}

// 接口检测
emClient.checkJsApi = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('checkJsApi', params, callback)
}


// 截屏
emClient.getScreenShot = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getScreenShot', params, callback)
}


emClient.downloadFile = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('downloadFile', params, callback)
}

emClient.previewFile = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('previewFile', params, callback)
}



// 接口检测
emClient.changeAgreeStatus = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('changeAgreeStatus', params, callback)
}

// 支持的校验方式
emClient.securityEvaluation = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('securityEvaluation', params, callback)
}


// 支持的校验方式
emClient.securitySupport = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('securitySupport', params, callback)
}



// 手写签批
emClient.handleWriting = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('handleWriting', params, callback)
}

// 手写签批
emClient.editImage = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('editImage', params, callback)
}
// 标题弹出框
emClient.showPopup = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    var items = params['items']
    for (let i = 0; i < items.length; i++) {
        let item = items[i]
        let action = item['action']
        let name = item['name']
        WebViewJavascriptBridge.registerHandler(name, function(params, responseCallback) {
            action(params)
            responseCallback(item)
        })
    }
    WebViewJavascriptBridge.callHandler('showPopup', params, callback)
}
// 电子发票
emClient.chooseInvoiceTicket = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('chooseInvoiceTicket', params, callback)
}

// 获取当前会话类型
emClient.getConversation = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getConversation', params, callback)
}
emClient.getClientInfo = function(params) {
    var callback = function(response) {

        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getClientInfo', params, callback)
}

emClient.personCardSupport = function(params) {
    var callback = function(response) {

        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('personCardSupport', params, callback)
}
// 底部菜单栏
emClient.showBottomToolBar = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    var items = params['items']
    for (let i = 0; i < items.length; i++) {
        let item = items[i]
        let mainAction = item['action']
        let name = item['name']
        let subItems = item['subItems']
        let a='test';


        if (mainAction != undefined) {
            WebViewJavascriptBridge.registerHandler(name, function(params, responseCallback) {

                mainAction(params)
                responseCallback(item)
            })
        } else if (subItems instanceof Array) {

           for (let i = 0; i < subItems.length; i++) {

                 let  subItem=subItems[i]

                let subAction = subItem['action']
                let subName = subItem['name']
                if (subAction != undefined) {

                    WebViewJavascriptBridge.registerHandler(subName, function(params, responseCallback) {
                        subAction(params)
                        responseCallback(item)
                    })
                } else
                {

                }
            }
        } else
        {

        }
    }
    WebViewJavascriptBridge.callHandler('showBottomToolBar', params, callback)
}



// 隐藏底部
emClient.hideBottomToolBar = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('hideBottomToolBar', params, callback)
}

// 隐藏底部
emClient.changeTitle = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('changeTitle', params, callback)
}

// 配置头部
emClient.configNavigation = function(params) {
var callback = function(response) {
if (typeof response === 'string') {
response = JSON.parse(response)
}
var errCode = response.errCode
if (errCode === 0) //成功
{
var success = params['success']
if (typeof success === 'function') {
success(response)
}
} else if (errCode === -1) //取消
{
var cancel = params['cancel']
if (typeof cancel === 'function') {
cancel(response)
}
} else if (errCode != 0) //失败
{
var fail = params['fail']
if (typeof fail === 'function') {
fail(response)
}
}
var complete = params['complete'] //完成
if (typeof complete === 'function') {
complete(response)
}
}
var left = params['left']
if (left != undefined){
let item = left
let mainAction = item['action']
let name = item['name']
let subItems = item['subItems']



if (mainAction != undefined) {
WebViewJavascriptBridge.registerHandler(name, function(params, responseCallback) {

mainAction(params)
responseCallback(item)
})
} else if (subItems instanceof Array) {

for (let i = 0; i < subItems.length; i++) {
let  subItem=subItems[i]

let subAction = subItem['action']
let subName = subItem['name']
if (subAction != undefined) {

WebViewJavascriptBridge.registerHandler(subName, function(params, responseCallback) {
subAction(params)
responseCallback(item)
})
} else
{

}
}
} else
{

}
}
var right = params['right']
if (left != undefined){
let item = right
let mainAction = item['action']
let name = item['name']
let subItems = item['subItems']



if (mainAction != undefined) {
WebViewJavascriptBridge.registerHandler(name, function(params, responseCallback) {

mainAction(params)
responseCallback(item)
})
} else if (subItems instanceof Array) {

for (let i = 0; i < subItems.length; i++) {
let  subItem=subItems[i]

let subAction = subItem['action']
let subName = subItem['name']
if (subAction != undefined) {

WebViewJavascriptBridge.registerHandler(subName, function(params, responseCallback) {
subAction(params)
responseCallback(item)
})
} else
{

}
}
} else
{

}
}
WebViewJavascriptBridge.callHandler('configNavigation', params, callback)
}

// 底部菜单栏
emClient.showTopToolBar = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }


    var left = params['left']
      if (left != undefined){
        let item = left
        let mainAction = item['action']
        let name = item['name']
        let subItems = item['subItems']



        if (mainAction != undefined) {
            WebViewJavascriptBridge.registerHandler(name, function(params, responseCallback) {

                mainAction(params)
                responseCallback(item)
            })
        } else if (subItems instanceof Array) {

           for (let i = 0; i < subItems.length; i++) {

                 let  subItem=subItems[i]

                let subAction = subItem['action']
                let subName = subItem['name']
                if (subAction != undefined) {

                    WebViewJavascriptBridge.registerHandler(subName, function(params, responseCallback) {
                        subAction(params)
                        responseCallback(item)
                    })
                } else
                {

                }
            }
        } else
        {

        }
    }

     var right = params['right']
      if (right != undefined){
        let item = right
        let mainAction = item['action']
        let name = item['name']
        let subItems = item['subItems']



        if (mainAction != undefined) {
            WebViewJavascriptBridge.registerHandler(name, function(params, responseCallback) {

                mainAction(params)
                responseCallback(item)
            })
        } else if (subItems instanceof Array) {

           for (let i = 0; i < subItems.length; i++) {

                 let  subItem=subItems[i]

                let subAction = subItem['action']
                let subName = subItem['name']
                if (subAction != undefined) {

                    WebViewJavascriptBridge.registerHandler(subName, function(params, responseCallback) {
                        subAction(params)
                        responseCallback(item)
                    })
                } else
                {

                }
            }
        } else
        {

        }
    }
    var items = params['items']
    for (let i = 0; i < items.length; i++) {
        let item = items[i]
        let mainAction = item['action']
        let name = item['name']
        let subItems = item['subItems']



        if (mainAction != undefined) {
            WebViewJavascriptBridge.registerHandler(name, function(params, responseCallback) {

                mainAction(params)
                responseCallback(item)
            })
        } else if (subItems instanceof Array) {

           for (let i = 0; i < subItems.length; i++) {

                 let  subItem=subItems[i]

                let subAction = subItem['action']
                let subName = subItem['name']
                if (subAction != undefined) {

                    WebViewJavascriptBridge.registerHandler(subName, function(params, responseCallback) {
                        subAction(params)
                        responseCallback(item)
                    })
                } else
                {

                }
            }
        } else
        {

        }
    }
    WebViewJavascriptBridge.callHandler('showTopToolBar', params, callback)
}



// 隐藏顶部
emClient.hideTopToolBar = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('hideTopToolBar', params, callback)
}

// 复制文字
emClient.setPasteBoardText = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('setPasteBoardText', params, callback)
}
// 获取剪贴板文字
emClient.getPasteBoardText = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getPasteBoardText', params, callback)
}
emClient.resetNavigation = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('resetNavigation', params, callback)
}
//地理位置列表可选位置
emClient.getLocationList = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getLocationList', params, callback)
}

//录音
emClient.getAudioRecord = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getAudioRecord', params, callback)
}
//播放语音
emClient.playAudioRecord = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('playAudioRecord', params, callback)
}

//获取当前用户对于某个集成系统或者某个应用的授权认证code
emClient.getEmAuthCode = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getEmAuthCode', params, callback)
}
//通过config接口注入配置
emClient.config = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('config', params, callback)
}
//允许底部按钮点击
emClient.userInteractionEnabled = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('userInteractionEnabled', params, callback)
}
//禁止底部按钮点击
emClient.userInteractionDisabled = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('userInteractionDisabled', params, callback)
}

//语音转文字
emClient.speechTotext = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    var speechTotext=params['speechTotext']
    if (typeof speechTotext === 'function') {
        WebViewJavascriptBridge.registerHandler('speechTotext', function(params, responseCallback) {

                                                speechTotext(params)

                                                })
    }
    WebViewJavascriptBridge.callHandler('speechTotext', params, callback)
}
//语音播报
emClient.playVoice = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('playVoice', params, callback)
}
//语音听写
emClient.continueSpeech = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }

    var changeVoice=params['changeVoice']
    if (typeof changeVoice === 'function') {
        WebViewJavascriptBridge.registerHandler('changeVoice', function(params, responseCallback) {

                                                changeVoice(params)

                                                })
    }

    var continueSpeechend=params['continueSpeechend']
    if (typeof continueSpeechend === 'function') {
        WebViewJavascriptBridge.registerHandler('continueSpeechend', function(params, responseCallback) {

                                                continueSpeechend(params)

                                                })
    }

    var onContinueSpeech=params['onContinueSpeech']
    if (typeof continueSpeechend === 'function') {
        WebViewJavascriptBridge.registerHandler('onContinueSpeech', function(params, responseCallback) {

                                                onContinueSpeech(params)

                                                })
    }

    WebViewJavascriptBridge.callHandler('continueSpeech', params, callback)
}
//文字语义理解
emClient.textUnderStand = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('textUnderStand', params, callback)
}

//停止播报和听写
emClient.stopVoice = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('stopVoice', params, callback)
}

// 获取应用列表
emClient.getModule = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getModule', params, callback)
}

// 打开应用
emClient.openModule = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('openModule', params, callback)
}

//导航
emClient.navigationLBS = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('navigationLBS', params, callback)
}


// 加载客户端调用
emClient.ready = function(params) {

    if (typeof params === 'function')
    {

        var callback = params


        WebViewJavascriptBridge.registerHandler('ready', callback)
    }




}

// 父级关闭，刷新子页面
emClient.reloadStorage = function(params) {

    if (typeof params === 'function')
    {

        var callback = params


        WebViewJavascriptBridge.registerHandler('reloadStorage', callback)
    }




}


// 父级关闭，刷新子页面支持传参
emClient.reloadStorageWithParams = function(params) {

    if (typeof params === 'function')
    {

        var callback = params


        WebViewJavascriptBridge.registerHandler('reloadStorageWithParams', callback)
    }




}

//注册广播
emClient.registerBroadcast = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    var name=params['name']
    var action=params['action']
    if (typeof action === 'function'&& name!=undefined) {
        WebViewJavascriptBridge.registerHandler(name, function(params, responseCallback) {

                                                action(params)

                                                })
    }
    WebViewJavascriptBridge.callHandler('registerBroadcast', params, callback)
}
//
emClient.postBroadcast = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('postBroadcast', params, callback)
}

//发地理位置
emClient.sendLocation = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('sendLocation', params, callback)
}

//发名片
emClient.sendPersonCard = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('sendPersonCard', params, callback)
}
//打电话
emClient.tel = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('tel', params, callback)
}
//发邮件
emClient.mailto = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('mailto', params, callback)
}

//发短信
emClient.textMessage = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('textMessage', params, callback)
    }
 //显示水印
 emClient.showWaterMark = function(params) {
     var callback = function(response) {
         if (typeof response === 'string') {
             response = JSON.parse(response)
         }
         var errCode = response.errCode
         if (errCode === 0) //成功
         {
             var success = params['success']
             if (typeof success === 'function') {
                 success(response)
             }
         } else if (errCode === -1) //取消
         {
             var cancel = params['cancel']
             if (typeof cancel === 'function') {
                 cancel(response)
             }
         } else if (errCode != 0) //失败
         {
             var fail = params['fail']
             if (typeof fail === 'function') {
                 fail(response)
             }
         }
         var complete = params['complete'] //完成
         if (typeof complete === 'function') {
             complete(response)
         }
     }
     WebViewJavascriptBridge.callHandler('showWaterMark', params, callback)
     }

      //隐藏水印
      emClient.hideWaterMark = function(params) {
          var callback = function(response) {
              if (typeof response === 'string') {
                  response = JSON.parse(response)
              }
              var errCode = response.errCode
              if (errCode === 0) //成功
              {
                  var success = params['success']
                  if (typeof success === 'function') {
                      success(response)
                  }
              } else if (errCode === -1) //取消
              {
                  var cancel = params['cancel']
                  if (typeof cancel === 'function') {
                      cancel(response)
                  }
              } else if (errCode != 0) //失败
              {
                  var fail = params['fail']
                  if (typeof fail === 'function') {
                      fail(response)
                  }
              }
              var complete = params['complete'] //完成
              if (typeof complete === 'function') {
                  complete(response)
              }
          }
          WebViewJavascriptBridge.callHandler('hideWaterMark', params, callback)


}

      //横竖屏切换
                emClient.changeOrientation = function(params) {
                    var callback = function(response) {
                        if (typeof response === 'string') {
                            response = JSON.parse(response)
                        }
                        var errCode = response.errCode
                        if (errCode === 0) //成功
                        {
                            var success = params['success']
                            if (typeof success === 'function') {
                                success(response)
                            }
                        } else if (errCode === -1) //取消
                        {
                            var cancel = params['cancel']
                            if (typeof cancel === 'function') {
                                cancel(response)
                            }
                        } else if (errCode != 0) //失败
                        {
                            var fail = params['fail']
                            if (typeof fail === 'function') {
                                fail(response)
                            }
                        }
                        var complete = params['complete'] //完成
                        if (typeof complete === 'function') {
                            complete(response)
                        }
                    }
                    WebViewJavascriptBridge.callHandler('changeOrientation', params, callback)
    }
emClient.openNativeSetting = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('openNativeSetting', params, callback)

}

emClient.getContacts = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getContacts', params, callback)

}
emClient.isFreshUser = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('isFreshUser', params, callback)

}
emClient.getUserInfo = function(params) {
    var callback = function(response) {
        if (typeof response === 'string') {
            response = JSON.parse(response)
        }
        var errCode = response.errCode
        if (errCode === 0) //成功
        {
            var success = params['success']
            if (typeof success === 'function') {
                success(response)
            }
        } else if (errCode === -1) //取消
        {
            var cancel = params['cancel']
            if (typeof cancel === 'function') {
                cancel(response)
            }
        } else if (errCode != 0) //失败
        {
            var fail = params['fail']
            if (typeof fail === 'function') {
                fail(response)
            }
        }
        var complete = params['complete'] //完成
        if (typeof complete === 'function') {
            complete(response)
        }
    }
    WebViewJavascriptBridge.callHandler('getUserInfo', params, callback)

}




emClient.openWXMiniProgram = function(params) {
        var callback = function(response) {
            if (typeof response === 'string') {
                response = JSON.parse(response)
            }
            var errCode = response.errCode
            if (errCode === 0) //成功
            {
                var success = params['success']
                if (typeof success === 'function') {
                    success(response)
                }
            } else if (errCode === -1) //取消
            {
                var cancel = params['cancel']
                if (typeof cancel === 'function') {
                    cancel(response)
                }
            } else if (errCode != 0) //失败
            {
                var fail = params['fail']
                if (typeof fail === 'function') {
                    fail(response)
                }
            }
            var complete = params['complete'] //完成
            if (typeof complete === 'function') {
                complete(response)
            }
        }
        WebViewJavascriptBridge.callHandler('openWXMiniProgram', params, callback)
        }

        emClient.readNFC = function(params) {
                var callback = function(response) {
                    if (typeof response === 'string') {
                        response = JSON.parse(response)
                    }
                    var errCode = response.errCode
                    if (errCode === 0) //成功
                    {
                        var success = params['success']
                        if (typeof success === 'function') {
                            success(response)
                        }
                    } else if (errCode === -1) //取消
                    {
                        var cancel = params['cancel']
                        if (typeof cancel === 'function') {
                            cancel(response)
                        }
                    } else if (errCode != 0) //失败
                    {
                        var fail = params['fail']
                        if (typeof fail === 'function') {
                            fail(response)
                        }
                    }
                    var complete = params['complete'] //完成
                    if (typeof complete === 'function') {
                        complete(response)
                    }
                }
                WebViewJavascriptBridge.callHandler('readNFC', params, callback)
                }




         emClient.contentofFile = function(params) {
                 var callback = function(response) {
                    if (typeof response === 'string') {
                         response = JSON.parse(response)
                      }
                     var errCode = response.errCode
                     if (errCode === 0) //成功
                     {
                         var success = params['success']
                         if (typeof success === 'function') {
                             success(response)
                         }
                     } else if (errCode === -1) //取消
                     {
                         var cancel = params['cancel']
                         if (typeof cancel === 'function') {
                             cancel(response)
                         }
                     } else if (errCode != 0) //失败
                     {
                         var fail = params['fail']
                         if (typeof fail === 'function') {
                             fail(response)
                         }
                     }
                     var complete = params['complete'] //完成
                     if (typeof complete === 'function') {
                         complete(response)
                     }
                 }
                 WebViewJavascriptBridge.callHandler('contentofFile', params, callback)
                 }

 emClient.UIApplicationUserDidTakeScreenshotNotification = function(params) {
                var callback = function(response) {
                    if (typeof response === 'string') {
                        response = JSON.parse(response)
                    }
                    var errCode = response.errCode
                    if (errCode === 0) //成功
                    {
                        var success = params['success']
                        if (typeof success === 'function') {
                            success(response)
                        }
                    } else if (errCode === -1) //取消
                    {
                        var cancel = params['cancel']
                        if (typeof cancel === 'function') {
                            cancel(response)
                        }
                    } else if (errCode != 0) //失败
                    {
                        var fail = params['fail']
                        if (typeof fail === 'function') {
                            fail(response)
                        }
                    }
                    var complete = params['complete'] //完成
                    if (typeof complete === 'function') {
                        complete(response)
                    }
                }
                WebViewJavascriptBridge.callHandler('UIApplicationUserDidTakeScreenshotNotification', params, callback)
                }

emClient.setAppLocalLanguage = function(params) {
                    var callback = function(response) {
                        if (typeof response === 'string') {
                            response = JSON.parse(response)
                        }
                        var errCode = response.errCode
                        if (errCode === 0) //成功
                        {
                            var success = params['success']
                            if (typeof success === 'function') {
                                success(response)
                            }
                        } else if (errCode === -1) //取消
                        {
                            var cancel = params['cancel']
                            if (typeof cancel === 'function') {
                                cancel(response)
                            }
                        } else if (errCode != 0) //失败
                        {
                            var fail = params['fail']
                            if (typeof fail === 'function') {
                                fail(response)
                            }
                        }
                        var complete = params['complete'] //完成
                        if (typeof complete === 'function') {
                            complete(response)
                        }
                    }
                    WebViewJavascriptBridge.callHandler('setAppLocalLanguage', params, callback)
                }

emClient.uploadFile2Doc = function(params) {
        var callback = function(response) {
            if (typeof response === 'string') {
                response = JSON.parse(response)
            }
            var errCode = response.errCode
            if (errCode === 0) //成功
            {
                var success = params['success']
                if (typeof success === 'function') {
                    success(response)
                }
            } else if (errCode === -1) //取消
            {
                var cancel = params['cancel']
                if (typeof cancel === 'function') {
                    cancel(response)
                }
            } else if (errCode != 0) //失败
            {
                var fail = params['fail']
                if (typeof fail === 'function') {
                    fail(response)
                }
            }
            var complete = params['complete'] //完成
            if (typeof complete === 'function') {
                complete(response)
            }
        }
        WebViewJavascriptBridge.callHandler('uploadFile2Doc', params, callback)
        }
// 清空文件缓存
emClient.clearFileCaches = function(params) {
                                var callback = function(response) {
                                    if (typeof response === 'string') {
                                        response = JSON.parse(response)
                                    }
                                    var errCode = response.errCode
                                    if (errCode === 0) //成功
                                    {
                                        var success = params['success']
                                        if (typeof success === 'function') {
                                            success(response)
                                        }
                                    } else if (errCode === -1) //取消
                                    {
                                        var cancel = params['cancel']
                                        if (typeof cancel === 'function') {
                                            cancel(response)
                                        }
                                    } else if (errCode != 0) //失败
                                    {
                                        var fail = params['fail']
                                        if (typeof fail === 'function') {
                                            fail(response)
                                        }
                                    }
                                    var complete = params['complete'] //完成
                                    if (typeof complete === 'function') {
                                        complete(response)
                                    }
                                }
                                WebViewJavascriptBridge.callHandler('clearFileCaches', params, callback)
                                }

// 清空全部缓存
emClient.clearAllCaches = function(params) {
                                var callback = function(response) {
                                    if (typeof response === 'string') {
                                        response = JSON.parse(response)
                                    }
                                    var errCode = response.errCode
                                    if (errCode === 0) //成功
                                    {
                                        var success = params['success']
                                        if (typeof success === 'function') {
                                            success(response)
                                        }
                                    } else if (errCode === -1) //取消
                                    {
                                        var cancel = params['cancel']
                                        if (typeof cancel === 'function') {
                                            cancel(response)
                                        }
                                    } else if (errCode != 0) //失败
                                    {
                                        var fail = params['fail']
                                        if (typeof fail === 'function') {
                                            fail(response)
                                        }
                                    }
                                    var complete = params['complete'] //完成
                                    if (typeof complete === 'function') {
                                        complete(response)
                                    }
                                }
                                WebViewJavascriptBridge.callHandler('clearAllCaches', params, callback)
                                }
// 清空web缓存
emClient.clearWebCaches = function(params) {
                                var callback = function(response) {
                                    if (typeof response === 'string') {
                                        response = JSON.parse(response)
                                    }
                                    var errCode = response.errCode
                                    if (errCode === 0) //成功
                                    {
                                        var success = params['success']
                                        if (typeof success === 'function') {
                                            success(response)
                                        }
                                    } else if (errCode === -1) //取消
                                    {
                                        var cancel = params['cancel']
                                        if (typeof cancel === 'function') {
                                            cancel(response)
                                        }
                                    } else if (errCode != 0) //失败
                                    {
                                        var fail = params['fail']
                                        if (typeof fail === 'function') {
                                            fail(response)
                                        }
                                    }
                                    var complete = params['complete'] //完成
                                    if (typeof complete === 'function') {
                                        complete(response)
                                    }
                                }
                                WebViewJavascriptBridge.callHandler('clearWebCaches', params, callback)
                                }